﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LL.Common
{
    public static class IEnumerableExtensions
    {
        public static T GetFirst<T>(this IEnumerable data)
            where T : class
        {
            IEnumerator tor;
            if (data == null || !(tor = data.GetEnumerator()).MoveNext())
                return null;
            return tor.Current.Cast<T>();
        }
    }
}
